#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "api.h"
#include "params.h"
#include "indcpa.h"
#include "poly.h"
#include "polyvec.h"
#include "utils/cpucycles.h"
#include "utils/speed_print.h"

#include <pthread.h>
#include "test_multi_thread.h"

FILE* fp_list[8] = {0};
pthread_t th[8];

void test_debug_indcpa_dec(void *arg) { // Test success.

    long threadno = (long)arg;
    char filename[30] = {0};
    sprintf(filename, "thread_%ld_output.txt", threadno);
    printf("Filename: %s\n", filename);
    FILE *thread_output = fopen(filename, "w");


    fprintf(thread_output, "Start test_debug_indcpa_dec()\n");
    unsigned char m[KYBER_INDCPA_MSGBYTES];
    unsigned char m_ground_truth[KYBER_INDCPA_MSGBYTES] = {
        0x0a, 0x55, 0xa4, 0x43, 0x3d, 0xba, 0xac, 0x3b, 0x61, 0x6d, 0x6c, 0x43, 0x38, 0xfc, 0xae, 0xc4, 0xa9, 0x68, 0x5e, 0x8a, 0xa3, 0x7d, 0x6a, 0x5b, 0xd7, 0x4d, 0x61, 0x94, 0x95, 0xcd, 0x3f, 0xed
    };
    unsigned char c[KYBER_INDCPA_BYTES] = {
        0xed, 0xf2, 0x41, 0x45, 0xe4, 0x3b, 0x4f, 0x6d, 0xc6, 0xbf, 0x83, 0x32, 0xf5, 0x4e, 0x02, 0xca, 0xb0, 0x2d, 0xbf, 0x3b, 0x56, 0x05, 0xdd, 0xc9, 0x0a, 0x15, 0xc8, 0x86, 0xad, 0x3e, 0xd4, 0x89, 0x46, 0x26, 0x99, 0xe4, 0xab, 0xed, 0x44, 0x35, 0x0b, 0xc3, 0x75, 0x7e, 0x26, 0x96, 0xfb, 0xfb, 0x25, 0x34, 0x41, 0x2e, 0x8d, 0xd2, 0x01, 0xf1, 0xe4, 0x54, 0x0a, 0x39, 0x70, 0xb0, 0x55, 0xfe, 0x3b, 0x0b, 0xec, 0x3a, 0x71, 0xf9, 0xe1, 0x15, 0xb3, 0xf9, 0xf3, 0x91, 0x02, 0x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, 0xc7, 0x6f, 0xe6, 0xbe, 0x52, 0x3a, 0x89, 0x3c, 0xc7, 0x64, 0xd1, 0x64, 0x35, 0xc3, 0x78, 0x51, 0x25, 0x2a, 0x81, 0xe2, 0xff, 0xba, 0x0f, 0x18, 0x97, 0x1a, 0x3d, 0xee, 0x37, 0xd4, 0x87, 0x7c, 0xb9, 0x28, 0xe3, 0x6e, 0x52, 0x35, 0x03, 0x7a, 0x6b, 0x20, 0x57, 0x89, 0x7d, 0x51, 0x8a, 0x5f, 0x0e, 0x34, 0x8e, 0x3a, 0xb6, 0xd5, 0xb5, 0x2d, 0xfc, 0x60, 0x75, 0x7f, 0x3b, 0x41, 0xa4, 0xfe, 0xc7, 0x82, 0x8f, 0x1d, 0xee, 0xaf, 0x45, 0x87, 0xcc, 0xc8, 0xea, 0xdf, 0x64, 0x7f, 0x4d, 0x20, 0x3b, 0x2f, 0xaa, 0x05, 0xa6, 0x49, 0xb5, 0x82, 0x34, 0x0c, 0xb4, 0xca, 0xce, 0x57, 0xa3, 0x07, 0x11, 0xbe, 0x75, 0x2f, 0xac, 0xf0, 0x22, 0x7d, 0x0a, 0x80, 0xc4, 0x12, 0x84, 0x42, 0xdd, 0xc5, 0x44, 0xbe, 0x80, 0x5b, 0x9c, 0xfe, 0x8f, 0xe9, 0xb1, 0x23, 0x7c, 0x80, 0xf9, 0x67, 0x87, 0xcd, 0x92, 0x81, 0xcc, 0xf2, 0x70, 0xc1, 0xaf, 0xc0, 0x67, 0x0d
    };
    unsigned char sk[CRYPTO_SECRETKEYBYTES] = {
        0x6c, 0x89, 0x2b, 0x02, 0x97, 0xa9, 0xc7, 0x64, 0x14, 0x93, 0xf8, 0x7d, 0xaf, 0x35, 0x33, 0xee, 0xd6, 0x1f, 0x07, 0xf4, 0x65, 0x20, 0x66, 0x33, 0x7e, 0xd7, 0x40, 0x46, 0xdc, 0xc7, 0x1b, 0xa0, 0x3f, 0x30, 0x96, 0x01, 0x03, 0x16, 0x1f, 0x7d, 0x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0x39, 0x22, 0xb4, 0x51, 0x87, 0xbb, 0x65, 0xea, 0xfd, 0x46, 0x5f, 0xc6, 0x4a, 0x0c, 0x5f, 0x8f, 0x3f, 0x90, 0x03, 0x48, 0x94, 0x15, 0x89, 0x9d, 0x59, 0xa5, 0x43, 0xd8, 0x20, 0x8c, 0x54, 0xa3, 0x16, 0x65, 0x29, 0xb5, 0x39, 0x22, 0x7f, 0xfa, 0xd1, 0xbc, 0x8a, 0xf7, 0x3b, 0x7e, 0x87, 0x49, 0x56, 0xb8, 0x1c, 0x2a, 0x2e, 0xf0, 0xbf, 0xab, 0xe8, 0xdc, 0x93, 0xd7, 0x7b, 0x2f, 0xbc, 0x9e, 0x0c, 0x64, 0xef, 0xa0, 0x1e, 0x84, 0x86, 0x26, 0xed, 0x79, 0xd4, 0x51, 0x14, 0x08, 0x00, 0xe0, 0x3b, 0x59, 0xb9, 0x56, 0xf8, 0x21, 0x0e, 0x55, 0x60, 0x67, 0x40, 0x7d, 0x13, 0xdc, 0x90, 0xfa, 0x9e, 0x8b, 0x87, 0x2b, 0xfb, 0x8f
    };
    
    indcpa_dec(m, c, sk);


    if ( memcmp(m, m_ground_truth, KYBER_INDCPA_MSGBYTES) ) {
        fprintf(thread_output, "m_res: ");
        for(int i = 0; i < KYBER_INDCPA_MSGBYTES; i++) {
            fprintf(thread_output, "0x%02x, ", m[i]);
        }
        fprintf(thread_output, "\n");
        fprintf(thread_output, "m_ground_truth: ");
        for(int i = 0; i < KYBER_INDCPA_MSGBYTES; i++) {
            fprintf(thread_output, "0x%02x, ", m_ground_truth[i]);
        }
        fprintf(thread_output, "\n");
    } else{

        fprintf(thread_output, "SUccess!\n");
    }

    fclose(thread_output);
}

void test_debug_kem_enc_dec(void *arg) {

    long threadno = (long)arg;
    FILE *thread_output = fp_list[threadno];

    unsigned char m[KYBER_INDCPA_MSGBYTES];
    unsigned char m_ground_truth[KYBER_INDCPA_MSGBYTES] = {
        0x0a, 0x55, 0xa4, 0x43, 0x3d, 0xba, 0xac, 0x3b, 0x61, 0x6d, 0x6c, 0x43, 0x38, 0xfc, 0xae, 0xc4, 0xa9, 0x68, 0x5e, 0x8a, 0xa3, 0x7d, 0x6a, 0x5b, 0xd7, 0x4d, 0x61, 0x94, 0x95, 0xcd, 0x3f, 0xed
    };
    unsigned char c[CRYPTO_CIPHERTEXTBYTES] = {
        0x4f, 0xdf, 0xeb, 0x37, 0x03, 0x2e, 0xdf, 0x25, 0x3d, 0x8f, 0x57, 0xab, 0xe2, 0xe3, 0x56, 0x9d, 0x7e, 0xd8, 0x56, 0x56, 0x1c, 0xe1, 0x5b, 0x13, 0x85, 0xaa, 0x94, 0x46, 0x4a, 0x80, 0x59, 0x01, 0x3f, 0x7c, 0xd7, 0xce, 0x3b, 0x85, 0x85, 0x82, 0xc9, 0x3e, 0xfa, 0x4e, 0x12, 0x28, 0x18, 0x85, 0x7e, 0xe0, 0x5d, 0x5a, 0x8f, 0x25, 0x1d, 0x35, 0x86, 0xae, 0xe4, 0x55, 0xa8, 0x76, 0x2d, 0xdf, 0xf9, 0x4e, 0xf9, 0x03, 0x9e, 0x02, 0x71, 0x70, 0x86, 0x40, 0x57, 0xaa, 0x65, 0x8d, 0x0a, 0x3d, 0xda, 0xc6, 0x65, 0x1e, 0x92, 0xf9, 0x5c, 0xa6, 0xd9, 0x40, 0xde, 0x14, 0x5a, 0x3e, 0x32, 0x24, 0x50, 0x64, 0x30, 0x49, 0x35, 0x8a, 0x63, 0xe6, 0x7e, 0xaf, 0xf0, 0xcc, 0xe9, 0x3b, 0xc0, 0x0d, 0xc5, 0x47, 0xc5, 0x21, 0xae, 0xa9, 0x16, 0xca, 0x57, 0x4f, 0x26, 0x1e, 0x22, 0xda, 0x4c, 0x3f, 0x7e, 0xf4, 0x53, 0x22, 0x2c, 0x30, 0xcf, 0xc4, 0x68, 0x1e, 0x66, 0x15, 0x7c, 0x17, 0x86, 0xe3, 0x70, 0x09, 0xe9, 0x0a, 0x54, 0xd8, 0x56, 0x1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xca, 0xf1, 0x49, 0xb7, 0xfc, 0x5b, 0x5e, 0x44, 0xc8, 0x23, 0x11, 0x90, 0x83, 0x2e, 0x97, 0x4c, 0x6e, 0x0f, 0xbb, 0x79, 0xe5, 0x60, 0x80, 0x7c, 0x9c, 0x9f, 0x29, 0x4c, 0x01, 0xaa, 0x64, 0x28, 0xa7, 0x87, 0x45, 0x42, 0xc5, 0x58, 0x17, 0xef, 0x8e, 0x2e, 0x93, 0x59, 0x5d, 0x3f, 0x61, 0x05, 0x84, 0xa1, 0x16, 0x95, 0xd4, 0xb5, 0x7b, 0x40, 0x95, 0x6a, 0x57, 0x14, 0xcd, 0x6d, 0x4e, 0xd1, 0x5f, 0x59
    };
    unsigned char sk[CRYPTO_SECRETKEYBYTES] = {
        0x88, 0x8c, 0xca, 0xdd, 0x8b, 0x33, 0x1d, 0xe6, 0x9b, 0xcb, 0x12, 0xc5, 0xf7, 0x79, 0xb1, 0xf1, 0x80, 0xba, 0xc1, 0x5a, 0x96, 0xfd, 0x72, 0x5c, 0x1d, 0xa1, 0xc6, 0xfe, 0x35, 0x64, 0xa7, 0x94, 0xc8, 0x2e, 0xb5, 0xa5, 0x1c, 0x44, 0x2c, 0x42, 0xa4, 0xcd, 0x47, 0xc6, 0x14, 0x30, 0xa3, 0x49, 0x5d, 0xd6, 0x62, 0x5b, 0x8a, 0x46, 0xa7, 0xf7, 0x7a, 0xa4, 0x04, 0x7b, 0xaa, 0xd2, 0xae, 0xc1, 0x28, 0x45, 0x4a, 0xf8, 0x42, 0x1a, 0x8a, 0x76, 0x06, 0x33, 0x34, 0x67, 0xfc, 0x9a, 0xf5, 0x83, 0xce, 0x9f, 0xc6, 0x28, 0x73, 0x44, 0x43, 0xf0, 0xf1, 0x6d, 0x55, 0x59, 0x2b, 0x7f, 0xc3, 0xa1, 0x83, 0xbb, 0x23, 0x6a, 0xe8, 0x24, 0x87, 0x53, 0x3d, 0x88, 0x3c, 0xcf, 0xaa, 0x6a, 0xb9, 0x8b, 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0xbd, 0x57, 0x62, 0xa7, 0x92, 0x74, 0x65, 0x19, 0x69, 0x87, 0xea, 0x1b, 0x5f, 0xd5, 0xf9, 0x65, 0x12, 0xf2, 0xbf, 0x59, 0x49, 0x3e, 0xf5, 0xc4, 0xae, 0xf6, 0x18, 0xb9, 0xaf, 0x93, 0x99, 0x00, 0x90, 0x60, 0xe6, 0xd9, 0xc6, 0x88, 0xe6, 0x5d, 0x53, 0x64, 0x84, 0xdd, 0x40, 0x59, 0x49, 0xe1, 0x33, 0xb6, 0x92, 0x45, 0x39, 0x67, 0xa0, 0x20, 0x67, 0x1c, 0x55, 0x13, 0x76, 0x15, 0x11, 0x9d, 0xcb, 0x96, 0xce, 0x56, 0x07, 0x37, 0x39, 0x49, 0x76, 0x72, 0x2a, 0x20, 0xc1, 0x59, 0x57, 0x75, 0xf8, 0x2d, 0x26, 0xd6, 0xb4, 0xfe, 0x12, 0x3f, 0xe9, 0x77, 0x3f, 0xba, 0x11, 0x0c, 0x23, 0xa0, 0x65, 0x94, 0x50, 0x67, 0xf8, 0x57, 0x13, 0xa4, 0x81, 0x79, 0xbf, 0xa2, 0xb1, 0x6e, 0x8b, 0xc4, 0xc3, 0x56, 0x97, 0x51, 0xc0, 0x94, 0x8a, 0x96, 0x4a, 0x95, 0x2b, 0x22, 0x32, 0xc7, 0x89, 0xde, 0x2c, 0x57, 0x0e, 0x74, 0x77, 0x18, 0x0c, 0xa9, 0x1c, 0x0b, 0x23, 0x82, 0xf8, 0x31, 0x0a, 0x14, 0xcd, 0xcb, 0x90, 0x25, 0x7e, 0x12, 0x50, 0x3d, 0x73, 0x65, 0x43, 0x60, 0x9a, 0x33, 0x31, 0x6e, 0xd3, 0x74, 0x6f, 0x98, 0x35, 0x03, 0x54, 0x1b, 0x23, 0xc0, 0x4c, 0x08, 0x27, 0x6c, 0x5e, 0x45, 0x89, 0x27, 0x6e, 0x8b, 0x6c, 0xbd, 0x9c, 0x9c, 0xac, 0xf9, 0x07, 0x68, 0x17,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08, 0x50, 0x40, 0x47, 0xe6, 0x77, 0xba, 0x88, 0xce, 0xb1, 0x69, 0x29, 0xf3, 0x70, 0x46, 0x1e, 0x41, 0x44, 0xa2, 0x99, 0x51, 0x17, 0xe7, 0x52, 0x0e, 0xcc, 0x3c, 0x83, 0x65, 0x69, 0xdf, 0x3b, 0x7c, 0x1c, 0xa3, 0x09, 0x02, 0xd5, 0x2d, 0x52, 0xca, 0x0b, 0xab, 0x9b, 0x05, 0xa9, 0x66, 0x8c, 0xc4, 0xf9, 0xb4, 0x8e, 0xc0, 0x55, 0xb9, 0x53, 0xc4, 0xec, 0xfc, 0x15, 0x1a, 0x50, 0x77, 0x11, 0x04, 0x69, 0x3f, 0x13, 0x07, 0x44, 0xa8, 0xcc, 0x1a, 0x09, 0x30, 0x3d, 0x40, 0x02, 0x62, 0xd8, 0x91, 0xf2, 0x14, 0xc6, 0xbd, 0x79, 0x4b, 0xac, 0x08, 0x93, 0x26, 0x5b, 0xb1, 0xa8, 0x83, 0x57, 0x35, 0xd8, 0x83, 0xb9, 0x15, 0x78, 0xe4, 0xd8, 0x39, 0x52, 0x2a, 0x12, 0x5f, 0x4b, 0x96, 0x60, 0x58, 0x0e, 0x04, 0x70, 0x5d, 0x65, 0x66, 0x96, 0xf7, 0x2c, 0x09, 0x1b, 0xd0, 0x56, 0xfd, 0x16, 0x82, 0x47, 0x96, 0x42, 0xac, 0x80, 0x0b, 0x66, 0xb0, 0x3f, 0x6f, 0x90, 0x01, 0x80, 0x76, 0x21, 0x8e, 0x53, 0x38, 0x32, 0xa7, 0x01, 0xfa, 0x95, 0x13, 0xe8, 0x65, 0x5c, 0x96, 0xd3, 0x4c, 0x7a, 0x92, 0xb3, 0x85, 0xb7, 0x71, 0x4c, 0xa9, 0x11, 0xc8, 0x76, 0x86, 0xd7, 0xc9, 0xc9, 0x84, 0xf0, 0x77, 0xd9, 0xa6, 0x11, 0xac, 0x99, 0x32, 0x5f, 0x57, 0x7d, 0x77, 0x7b, 0x02,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7a, 0x17, 0xf8, 0x01, 0x14, 0x35, 0xe0, 0x60, 0x09, 0x08, 0xaa, 0x43, 0xac, 0x33, 0x10, 0x03, 0xd0, 0xd6, 0x26, 0x6c, 0x25, 0xe1, 0xf8, 0xef, 0xe6, 0xd0, 0xac, 0xee, 0x8a, 0x49, 0xd8
    };
    unsigned char pk[CRYPTO_PUBLICKEYBYTES] = {
        0x35, 0xd8, 0x83, 0xb9, 0x15, 0x78, 0xe4, 0xd8, 0x39, 0x52, 0x2a, 0x12, 0x5f, 0x4b, 0x96, 0x60, 0x58, 0x0e, 0x04, 0x70, 0x5d, 0x65, 0x66, 0x96, 0xf7, 0x2c, 0x09, 0x1b, 0xd0, 0x56, 0xfd, 0x16, 0x82, 0x47, 0x96, 0x42, 0xac, 0x80, 0x0b, 0x66, 0xb0, 0x3f, 0x6f, 0x90, 0x01, 0x80, 0x76, 0x21, 0x8e, 0x53, 0x38, 0x32, 0xa7, 0x01, 0xfa, 0x95, 0x13, 0xe8, 0x65, 0x5c, 0x96, 0xd3, 0x4c, 0x7a, 0x92, 0xb3, 0x85, 0xb7, 0x71, 0x4c, 0xa9, 0x11, 0xc8, 0x76, 0x86, 0xd7, 0xc9, 0xc9, 0x84, 0xf0, 0x77, 0xd9, 0xa6, 0x11, 0xac, 0x99, 0x32, 0x5f, 0x57, 0x7d, 0x77, 0x7b, 0x02, 0xe0, 0x73, 0x69, 0xe9, 0xf5, 0xa3, 0x8a, 0x95, 0x94, 0x3d, 0x30, 0xb9, 0xd2, 0x47, 0x8a, 0xff, 0xcc, 0xc2, 0x74, 0xa8, 0x14, 0x27, 0x34, 0xb4, 0xfd, 0xd9, 0x45, 0x47, 0x95, 0x1c, 0x20, 0x87, 0xc3, 0x8a, 0xca, 0x90, 0x9f, 0xf9, 0x08, 0xf9, 0x1b, 0x0a, 0x85, 0x63, 0x31, 0xcf, 0x34, 0x8b, 0xa4, 0x66, 0xb4, 0x36, 0xd0, 0x24, 0x51, 0xb9, 0x52, 0x00,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, 0x72, 0x90, 0xf8, 0x34, 0xb7, 0x75, 0x44, 0x2a, 0x79, 0x42, 0x91, 0x82, 0x14, 0xde, 0x9c, 0x2a, 0x76, 0xf5, 0x00, 0xc8, 0x21, 0x2b, 0xc1, 0x75, 0x0e, 0x8e, 0xea, 0x58, 0xfa, 0x9b, 0x8b, 0xfd, 0xe0, 0x8d, 0x84, 0x56, 0x31, 0x64, 0x10, 0x72, 0xc4, 0xc2, 0x96, 0x3b, 0xb5, 0x94, 0x1c, 0xeb, 0xca, 0x4d, 0x46, 0x97, 0xc6, 0xf0, 0x42, 0xdb, 0xc0, 0x5a, 0x62, 0x48, 0x09, 0xe9, 0xc6, 0xdc, 0x3c, 0xf7, 0x9d, 0xf6, 0xcb, 0xad, 0x5a, 0xb7, 0xad, 0xbf, 0xae, 0xb8, 0x01, 0x58, 0xb3, 0xcb, 0x4f, 0x7e, 0x2f, 0x21, 0x1b, 0x67, 0x33, 0x2d, 0xd5, 0xc3, 0xe4, 0x0c, 0xcc
    };

    unsigned char ct[CRYPTO_CIPHERTEXTBYTES], ss[CRYPTO_BYTES], ss1[CRYPTO_BYTES];
    crypto_kem_enc(ct, ss, pk);
    crypto_kem_dec(ss1, ct, sk);

    if ( memcmp(ss, ss1, CRYPTO_BYTES) ) {
        fprintf(thread_output, "ss: \n");
        for(int i = 0; i < 32; i++) {
            fprintf(thread_output, "%02x ", ss[i]);
        }
        fprintf(thread_output, "\n");
        fprintf(thread_output, "ss1: \n");
        for(int i = 0; i < 32; i++) {
            fprintf(thread_output, "%02x ", ss1[i]);
        }
        fprintf(thread_output, "\n");
        fprintf(thread_output, "crypto_kem_decreturned bad 'ss' value\n");

    }
    
    fprintf(thread_output, "Finish!\n");
}


int main(int argc, char **argv)
{
    int num = 0;
    int multi_mode = 1;

    if(argc == 1) {
        multi_mode = 0;
    } else{
        num = atoi(argv[1]);
    }

    if(!multi_mode) {
        printf("single thread mode\n");
        char filename[30] = {0};
        sprintf(filename, "thread_%ld_output.txt", 0);
        printf("Filename: %s\n", filename);
        FILE *thread_output = fopen(filename, "w");
        fp_list[0] = thread_output;
        th[0] = pthread_self();
        test_debug_kem_enc_dec((void *)num);
    } else {
        printf("multi thread mode\n");
        for (int i = 0; i < num; i++) {

            /// NOTE: test kem enc dec multi thread correctness test success.
            char filename[30] = {0};
            sprintf(filename, "thread_%ld_output.txt", i);
            printf("Filename: %s\n", filename);
            FILE *thread_output = fopen(filename, "w");
            fp_list[i] = thread_output;
            pthread_create(&th[i], NULL, test_debug_kem_enc_dec, (void *)i);
        }  

        for (int i = 0; i < num; ++i)
            pthread_join(th[i], NULL);

    }


    return 0;
}
